def solve(haystack, needle):
    n1 = len(haystack)
    n2 = len(needle)
    if n2 > n1:
        return -1
    temp = ""
    for i in range(n1 - n2 + 1):
        temp = haystack[i:i + n2]
        if temp == needle:
            return i

    return -1


if __name__ == "__main__":
    haystack = "leetcode"
    needle = "leetco"
    print(solve(haystack, needle))
